﻿Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports ContactDataAccess

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service
    Inherits System.Web.Services.WebService


    <WebMethod()> _
    Public Function RetrieveContacts(ByVal Title As String) _
                          As AdventureWorksDataSet.ContactDataTable
        Dim ta As New AdventureWorksDataSetTableAdapters.ContactTableAdapter
        Return ta.GetData(Title)
    End Function

    <WebMethod()> _
    Public Sub SaveContacts(ByVal changes As Data.DataSet)
        Dim changesTable As Data.DataTable = changes.Tables(0)
        Dim ta As New AdventureWorksDataSetTableAdapters.ContactTableAdapter
        ta.Update(changesTable.Select)
    End Sub


End Class